<?php
include_once ('db.conf');

/* Connect to a MySQL server */
$link = mysqli_connect(DBHOST,DBUSER,DBPASS,DBDBNAME);

		$activlogin=$_POST["activlogin"];
		$activcode=$_POST["activcode"];
		//echo $activlogin;
		//echo $activcode;
		
		$query="call getBlockedCustomer('".$activlogin."');";
		
		$count=0;
		if($result = mysqli_query($link,$query ))
			while( $row = mysqli_fetch_assoc($result) ){
     			$count ++;   
    			$codefromDB=$row['comment'];
			}
		mysqli_close($link);
		$link = mysqli_connect(DBHOST,DBUSER,DBPASS,DBDBNAME);
		if (($count != 0)&&($codefromDB==$activcode)){
			$query="call unBlockCustomer('".$activlogin."');";
			$result = mysqli_query($link,$query);
			echo'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome to customers interface</title>
<style type="text/css">
<!--
.style5 {color: #0066FF; font-size: 24px; font-family: Arial, Helvetica, sans-serif; font-weight: bold; }
.style7 {
	font-size: 24px;
	font-family: Arial, Helvetica, sans-serif;
	color: #0066FF;
}
.style8 {
	font-size: 24px;
	font-family: Arial, Helvetica, sans-serif;
	color: #FFFFFF;
}
.style12 {
	font-size: 18;
}
.style17 {font-size: 16px}
.style18 {font-family: Arial, Helvetica, sans-serif}
.style20 {color: #FFFFFF}
.style21 {color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; }
-->
</style>
</head>

<body>
<p><img src="pics/main_logo_with_text_1010x12.gif" width="1010" height="124" /></p>
<table width="100%" border="0">
  <tr>
    <td colspan="2" align="left" bgcolor="#FF9900"><blockquote>
      <p><span class="style5"> Your account was activated :-)</span></p>
    </blockquote></td>
  </tr>
  <tr>
    <td width="76%" rowspan="3" align="center" valign="top"><blockquote>
      <p align="justify" class="style7">&nbsp;</p>
      <p align="justify" class="style7">Your account was activated, now you can sign in or just register next cell to earn more money.</p>
      </blockquote></td>
    <td width="24%" valign="top" bgcolor="#FF9900"><div align="center" class="style8">
      <p class="style12">registered users
        <label></label>
      </p>
      <form action="main.php" method="post" name="form1" class="style12" id="form1">
        <p>                                      
          <span class="style17">
          <label>login</label> <br />
          <input name="login" type="text" id="userlogin" value="';
 		  echo $activlogin;
		  echo'" />
          <br />
          <label>password</label><br />
          <input name="password" type="password" id="password" />
          </span>        </p>
        <p>
          <label>
            <input type="submit" name="send" id="send" value="Submit" />
            </label>
        </p>
      </form>
      </div>      </td>
  </tr>
  <tr>
    <td bgcolor="#FF9900" class="style12"><div align="center" class="style18"><a href="forgottpass.html" class="style20">forgotten password</a></div></td>
  </tr>
  <tr>
    <td bgcolor="#FF9900" class="style12"><div align="center" class="style18"><a href="register.html" class="style20">register new customer</a></div></td>
  </tr>
  
</table>
</body>
</html>

			
			';
    		
			
					
			}else{
			echo'
			<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome to customers interface</title>

<script type="text/javascript" language="JavaScript"><!--
function kontrola()
{
	var activlogin = self.document.forms.form1.activlogin.value;
	var activcode = self.document.forms.form1.activcode.value;

    var is_ok = false;
    if ((activlogin != "")&&(activcode != "")) is_ok = true;
	
	
	if (is_ok == false) alert("Sorry something is wrong or missing!");
    return is_ok; }
// -->
</script>


<style type="text/css">
<!--
.style5 {color: #0066FF; font-size: 24px; font-family: Arial, Helvetica, sans-serif; font-weight: bold; }
.style7 {
	font-size: 24px;
	font-family: Arial, Helvetica, sans-serif;
	color: #0066FF;
}
.style8 {
	font-size: 24px;
	font-family: Arial, Helvetica, sans-serif;
	color: #FFFFFF;
}
.style12 {
	font-size: 18;
}
.style17 {font-size: 16px}
.style18 {font-family: Arial, Helvetica, sans-serif}
.style20 {color: #FFFFFF}
.style21 {color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; }
-->
</style>
</head>

<body>
<p><img src="pics/main_logo_with_text_1010x12.gif" width="1010" height="124" /></p>
<table width="100%" border="0">
  <tr>
    <td colspan="2" align="left" bgcolor="#FF9900"><blockquote>
      <p><span class="style5"> Sorry  :-(</span></p>
    </blockquote></td>
  </tr>
  <tr>
    <td width="76%" rowspan="3" align="center" valign="top"><blockquote>
      <p align="justify" class="style7">&nbsp;</p>
      <p align="justify" class="style7">We are sorry, but these activation code is not right. Try it again.</p>
    </blockquote></td>
    <td width="24%" valign="top" bgcolor="#FF9900"><div align="center" class="style8">
      <p class="style12">account activation
        <label></label>
      </p>
      <form onSubmit="return kontrola();" action="unblockaccount.php" method="post" name="form1" class="style12" id="form1">
        <p>                                      
          <span class="style17">
          <label>cell</label> <br />
          <input name="activlogin" type="text" id="activlogin" value="'.$activlogin.'" />
          <br />
          <label>code</label><br />
          <input name="activcode" type="text" id="activcode" />
          </span>        </p>
        <p>
          <label>
            <input type="submit" name="send" id="send" value="Submit" />
            </label>
        </p>
      </form>
      </div>      </td>
  
  
</table>
</body>
</html>
			
			';
			}
		
?>